#ifndef _DevicesRT8092_H_
#define _DevicesRT8092_H_


/* RT8092 器件地址 */
#define RT8092_IIC_ADDR         0x38

#define RT8092_VOUT_SEL1_ADDR   0x10
#define RT8092_VOUT_SEL0_ADDR   0x11
#define RT8092_DISCHARGE_ADDR   0x12
#define RT8092_VOUT_MODE_ADDR   0x14
#define RT8092_IPEAK_ADDR       0x16
#define RT8092_PROTECT_ADDR     0x18
#define RT8092_LPM_ADDR         0x19

#define RT8092_VOUT_BANK1_ADDR  0x1C
#define RT8092_VOUT_BANK0_ADDR  0x1D

/* RT8092_VOUT_MODE_ADDR */
#define RT8092_VOUT_MODE_AUTO   0x00
#define RT8092_VOUT_MODE_PWM    0xC0

/* RT8092_IPEAK_ADDR */
#define RT8092_IPEAK_4_7A       0x00
#define RT8092_IPEAK_5_2A       0x40
#define RT8092_IPEAK_5_7A       0x80
#define RT8092_IPEAK_6_2A       0xD0

/* RT8092_PROTECT_ADDR */
#define RT8092_PROTECT_OCP      0x80
#define RT8092_PROTECT_SCP      0x10
#define RT8092_PROTECT_UVLO     0x02



/* RT8092 板载通道号 */
#define RT8092_CHANNEL_VDD1     0x01
#define RT8092_CHANNEL_VDD2H    0x02
#define RT8092_CHANNEL_VDD2L    0x04
#define RT8092_CHANNEL_VDDQ     0x08
#define RT8092_CHANNEL_ALL      0xFF



/* RT8092设置属性 */
typedef struct{
    float voltageSet;   /* 设置的电压值 */
    uint8_t regBank;    /* 设置的电压值所在的 Bank */
}RT8092PortType;

typedef struct{
    RT8092PortType vdd1;
    RT8092PortType vdd2H;
    RT8092PortType vdd2L;
    RT8092PortType vddQ;
}RT8092InfoType;



void vRT8092Init(void);
int8_t cRT8092ValueSet(uint32_t uiChannel, float fValue);
 float fRT8092GetErrorValue(uint8_t ucBank);
RT8092InfoType *ptypeRT8092InfoGet(void);



#endif
